import router, {addRouter} from './index';
import store from "../store";
import NProgress from 'nprogress'

router.beforeEach((to,from,next)=>{
  console.log('----------token-----------',store.getters.token)
  NProgress.start();
  if(to.path==='/login'){
    next();
  }else if(store.getters.token!==null){
    //如果有权限菜单在此处添加
    //router.addRoutes(store.getters.addRouters);
    next();
  }else{
    next({path:'/login'})
  }
})
router.afterEach(() => {
  NProgress.done();
})
